﻿using System.Web.Mvc;

namespace Manage.Filter
{
    public class LoginFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.HttpContext.Session["Admin"] == null)
            {
                filterContext.HttpContext.Response.Write("<script>parent.location.href='/Home/Login';</script>");
                filterContext.HttpContext.Response.End();
            }
        }
    }
}